package rlex.classes.program;

/*
 * WHILE COND THEN
 * 	COMMAND
 */
public class CommandWhile extends Command {
	private Expression cond;
	private Command code;
	
	public Expression getCond() {
		return cond;
	}
	public void setCond(Expression cond) {
		this.cond = cond;
	}
	public Command getCode() {
		return code;
	}
	public void setCode(Command code) {
		this.code = code;
	}
	
	public String toString() {
		String ret = "";
		ret += "while (" + cond.toString() + ") do (";
		ret += code.toString();
		ret += ")";
		return ret;
	}
	
	public void display(int level) {
		System.out.print("WHILE : ");
		cond.display(0);
		System.out.print("\nBEGIN : ");
		code.display(level + 1);
		System.out.print("\nEND BEGIN\n");
	}
}
